import { createRouter, RouteRecordRaw, createWebHashHistory } from 'vue-router';
import { h, resolveComponent } from 'vue';
import userAdmin from '@/pages/userOrder/userAdmin.vue';

const routes: Array<RouteRecordRaw> = [
	{
		path: '/',
		name: 'home',
		// component: Home,
		redirect: '/index/userOrder',
		// meta: {
		//   title: "首页",
		//   icon: "icon-shouye",
		//   hidden: true,
		// },
	},
	{
		path: '/index',
		name: 'Index',
		redirect: '/index/userOrder',
		component: () => import(/* webpackChunkName: "index" */ '@/pages/layout/index.vue'),
		children: [
			{
				path: 'userOrder',
				name: 'userOrder',
				meta: {
					title: '用户/订单',
					icon: 'icon-yonghu-dingdan',
				},
				component: {
					render: () => h(resolveComponent('router-view')),
				},
				redirect: { name: 'userAdmin' },
				children: [
					{
						path: 'userAdmin',
						name: 'userAdmin',
						component: userAdmin,
						meta: {
							title: '用户管理',
							parentName: 'userOrder',
						},
					},
					{
						path: 'authAdmin',
						name: 'authAdmin',
						component: () => import(/* webpackChunkName: "userOrder" */ '@/pages/userOrder/authAdmin.vue'),
						meta: {
							title: '授权管理',
							parentName: 'userOrder',
						},
					},
					{
						path: 'orderAdmin',
						name: 'orderAdmin',
						component: () => import(/* webpackChunkName: "userOrder" */ '@/pages/userOrder/orderAdmin.vue'),
						meta: {
							title: '订单管理',
							parentName: 'userOrder',
						},
					},
				],
			},
			{
				path: 'examineAdmin',
				name: 'examineAdmin',
				meta: {
					title: '审核管理',
					icon: 'icon-shenheguanli',
				},
				component: {
					render: () => h(resolveComponent('router-view')),
				},
				redirect: { name: 'invoiceAdmin' },
				children: [
					{
						path: 'invoiceAdmin',
						name: 'invoiceAdmin',
						meta: {
							title: '发票管理',
							parentName: 'examineAdmin',
						},
						component: () =>
							import(/* webpackChunkName: "examineAdmin" */ '@/pages/examineAdmin/invoiceAdmin.vue'),
					},
					{
						path: 'cashAdmin',
						name: 'cashAdmin',
						meta: {
							title: '提现审核',
							parentName: 'examineAdmin',
							adminType: [0, 1],
						},
						component: () =>
							import(/* webpackChunkName: "examineAdmin" */ '@/pages/examineAdmin/cashAdmin.vue'),
					},
					{
						path: 'contentExamine',
						name: 'contentExamine',
						meta: {
							title: '内容审核',
							parentName: 'examineAdmin',
						},
						component: () =>
							import(/* webpackChunkName: "examineAdmin" */ '@/pages/examineAdmin/contentExamine.vue'),
					},
					{
						path: 'receptionVerify',
						name: 'receptionVerify',
						meta: {
							title: '接待审核',
							parentName: 'examineAdmin',
						},
						component: () =>
							import(/* webpackChunkName: "receptionVerify" */ '@/pages/examineAdmin/receptionVerify.vue'),
					},
				],
			},
			{
				path: 'dataReport',
				name: 'dataReport',
				meta: {
					title: '数据报表',
					icon: 'icon-shujubaobiao',
				},
				component: {
					render: () => h(resolveComponent('router-view')),
				},
				redirect: { name: 'dataOverview' },
				children: [
					{
						path: 'dataOverview',
						name: 'dataOverview',
						component: () =>
							import(/* webpackChunkName: "dataReport" */ '@/pages/dataReport/dataOverview.vue'),
						meta: {
							title: '数据概览',
							parentName: 'dataReport',
						},
					},
					// {
					//   path: "userData",
					//   name: "userData",
					//   component: () => import("@/pages/dataReport/userData.vue"),
					//   meta: {
					//     title: "用户数据",
					//     parentName: "dataReport",
					//   },
					// },
					{
						path: 'activityData',
						name: 'activityData',
						component: () =>
							import(/* webpackChunkName: "dataReport" */ '@/pages/dataReport/activityData.vue'),
						meta: {
							title: '活动数据',
							parentName: 'dataReport',
						},
					},
					{
						path: 'receptionData',
						name: 'receptionData',
						component: () =>
							import(/* webpackChunkName: "dataReport" */ '@/pages/dataReport/receptionData.vue'),
						meta: {
							title: '接待数据',
							parentName: 'dataReport',
						},
					},
					{
						path: 'payData',
						name: 'payData',
						component: () => import(/* webpackChunkName: "dataReport" */ '@/pages/dataReport/payData.vue'),
						meta: {
							title: '付费数据',
							parentName: 'dataReport',
						},
					},
					// {
					//   path: "flowData",
					//   name: "flowData",
					//   component: () => import("@/pages/dataReport/flowData.vue"),
					//   meta: {
					//     title: "流量数据",
					//     parentName: "dataReport",
					//   },
					// },
				],
			},
			{
				path: 'systemSafety',
				name: 'systemSafety',
				meta: {
					title: '系统安全',
					icon: 'icon-xitonganquan',
					adminType: [0, 1],
				},
				component: {
					render: () => h(resolveComponent('router-view')),
				},
				redirect: { name: 'roleAuth' },
				children: [
					{
						path: 'roleAuth',
						name: 'roleAuth',
						meta: {
							title: '角色权限',
							parentName: 'systemSafety',
						},
						component: () =>
							import(/* webpackChunkName: "systemSafety" */ '@/pages/systemSafety/roleAuth.vue'),
					},
					{
						path: 'personAdmin',
						name: 'personAdmin',
						meta: {
							title: '人员管理',
							parentName: 'systemSafety',
						},
						component: () =>
							import(/* webpackChunkName: "systemSafety" */ '@/pages/systemSafety/personAdmin.vue'),
					},
					{
						path: 'operationJournal',
						name: 'operationJournal',
						meta: {
							title: '操作日志',
							parentName: 'systemSafety',
						},
						component: () =>
							import(/* webpackChunkName: "systemSafety" */ '@/pages/systemSafety/operationJournal.vue'),
					},
				],
			},
			{
				path: 'helpCenter',
				name: 'helpCenter',
				meta: {
					title: '帮助中心',
					icon: '',
					isHelpCenter: true,
				},
				component: () => import(/* webpackChunkName: helpCenter */ '@/pages/helpCenter/helpCenter.vue'),
			},
		],
	},
	{
		path: '/relogin',
		name: 'relogin',
		component: () => import(/* webpackChunkName: relogin */ '@/pages/relogin.vue'),
	},
];

export default createRouter({
	history: createWebHashHistory(),
	routes,
});
